/** FASSIT (Forms of Selective Attention in Intelligent Transportation Systems)
 * Computational Creativity and Digital Media
 * Cognitive and Media Systems Group
 * Centre for Informatics and Systems of the University of Coimbra (CISUC)
 *
 * Copyright (c) 2010-2013 University of Coimbra, Portugal
 * All rights reserved.
 */

package agent.DBManager;

import java.util.ArrayList;

import poi.Info.POI;
import poi.Info.POIwithSurprise;
import agent.Context.Context;
import agent.Metrics.Surprise.PastSurpriseValues;

/**
 * This class has the high level methods, allowing the agent to store and
 * retrieve information from the database
 * 
 * @author Hernani Costa
 * @version 0.2 date: 3/12/2012
 */
public class AgentDBManager {
	private AgentDBConnection aConnection;

	/**
	 * ------------------------------------------------------------------------
	 * Constructor class
	 * ------------------------------------------------------------------------
	 */
	public AgentDBManager() {
		aConnection = new AgentDBConnection();
	}

	/**
	 * ------------------------------------------------------------------------
	 * Only used by the class Train. Deletes all the Agent's Knowledge
	 * ------------------------------------------------------------------------
	 */
	public void deleteAgentKnowledge() {
		aConnection.deleteAgentKnowledge();
	}

	/**
	 * ------------------------------------------------------------------------
	 * Stores all the POIs visited by the Agent
	 * ------------------------------------------------------------------------
	 * 
	 * @param pois
	 *            - POIs visited
	 * @param context
	 *            - context when the Agent visited these POIs
	 */
	public void savePOIs(ArrayList<POI> pois, Context context) {
		aConnection.savePOIs(pois, context);
	}

	/**
	 * ------------------------------------------------------------------------
	 * Saves the Surprise values of a specific POI, i.e., the Surprise values
	 * for all the parameters (Price, DaysOff and Schedule)
	 * ------------------------------------------------------------------------
	 * 
	 * @param poiWithSurprise
	 *            - POI with the surprise values
	 * @param context
	 *            - the Agent's context
	 */
	public void saveSurpriseValues(POIwithSurprise poiWithSurprise,
			Context context) {

		aConnection.saveSurpriseValues(poiWithSurprise, context);
	}

	/**
	 * ------------------------------------------------------------------------
	 * Returns all Agent's Knowledge for the surprise values already visited by
	 * the Agent, considering a specific Context (Goal)
	 * ------------------------------------------------------------------------
	 * 
	 * @param context
	 *            - Context
	 * @return Surprise values the Agent has
	 */
	public PastSurpriseValues getSurpriseValuesForGoal(Context context) {
		return aConnection.getSurpriseValuesForGoal(context);
	}

}
